package com.sdx.console.video.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.beetl.sql.core.annotatoin.ColumnIgnore;
import org.beetl.sql.core.annotatoin.AutoID;
import org.beetl.sql.core.annotatoin.SeqID;
import org.apache.commons.lang3.StringUtils;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.sdx.service.ConfigService;

import org.beetl.sql.core.TailBean;
import java.math.*;

import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.entity.BaseEntity;

import org.beetl.sql.core.annotatoin.InsertIgnore;
import org.beetl.sql.core.annotatoin.Version;
import org.beetl.sql.core.annotatoin.LogicDelete;
import com.sdx.common.utils.Utils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

/*
*
* gen by Spring Boot2 Admin 2020-06-09
*/
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@Data
public class ConsultVideo extends BaseEntity{

    @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    @AutoID
    private Integer id ;

    //标题
    private String title ;

    //封面图
    private String cover ;


    private Integer come;

    //视频地址
    private String mediaUrl ;

    //视频腾讯云id
    private String fileId ;

    //视频类型 code_dict  VIDEO_TYPE
    private Integer videoType ;

    //可用标记 1、可用，0、不可用
    private Integer videoStatus ;

    //创建人
    private Integer createdBy ;

    //创建人名称
    private String createdName ;

    //创建时间
    private Date createdTime ;

    //更新人
    private Integer updatedBy ;

    //更新人名称
    private String updatedName ;

    //更新时间
    private Date updatedTime ;

	public String getCoverView(){
		return Utils.imageUrl(cover);
	}
	@ColumnIgnore
	@JsonIgnore
	private String createdTimeQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date createdTimeStart;
	@ColumnIgnore
	@JsonIgnore
	private Date createdTimeEnd;
	public String getCreatedTimeQuery(){
		return  createdTimeQuery;
	}
	public void setCreatedTimeQuery(String createdTimeQuery ){
		this.createdTimeQuery = createdTimeQuery;
		Date[] timePair = Utils.parseQueryTime(createdTimeQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.createdTimeStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.createdTimeEnd = timePair[1];
		}

	}
	public Date getCreatedTimeStart(){
		return  createdTimeStart;
	}
	public void setCreatedTimeStart(Date createdTimeStart ){
		this.createdTimeStart = createdTimeStart;
	}
	public Date getCreatedTimeEnd(){
		return  createdTimeEnd;
	}
	public void setCreatedTimeEnd(Date createdTimeEnd ){
		this.createdTimeEnd = createdTimeEnd;
	}

}
